package priv.pront.code.robot.robCom_pri_2022;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Set;
import java.util.TreeSet;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-06-30 20:34
 */
public class RC_v7_燕归来 {

    static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);
    static int n, m;
    static Set<String> newSet = new TreeSet<>();
    static Set<String> excludeSet = new TreeSet<>();

    public static void main(String[] args) throws IOException {
        String s = bf.readLine();
        n = Integer.parseInt(s);
        for (int i = 0; i < n; i++) {
            String ss = bf.readLine();
            excludeSet.add(ss);
        }

        m = Integer.parseInt(bf.readLine());
        for (int i = 0; i < m; i++) {
            String sss = bf.readLine();
            if (!excludeSet.contains(sss)) {
                newSet.add(sss);
            } else {
                excludeSet.remove(sss);
            }
        }

        if (excludeSet.size() == 0) {
            out.println("All Back");
            out.flush();
        } else {
            System.out.println("Missing: " + excludeSet.size());
            for (String s1 : excludeSet) {
                out.println(s1);
                out.flush();
            }
        }
        if (newSet.size() == 0) {
            out.println("All Known");
            out.flush();
        } else {
            System.out.println("New: " + newSet.size());
            for (String s1 : newSet) {
                out.println(s1);
                out.flush();
            }
        }
        out.close();
    }
}
